//
//  JQFYPayTypeVC.m
//  JQFY
//
//  Created by 代辉 on 2017/10/16.
//  Copyright © 2017年 yannis. All rights reserved.
//

#import "JQFYPayTypeVC.h"
#import "JQFYPayTypeCollectionViewCell.h"

@interface JQFYPayTypeVC ()
@property (nonatomic,strong) NSArray *imgs;
@end

@implementation JQFYPayTypeVC

static NSString * const reuseIdentifier = @"PayTypeCell";

- (void)viewDidLoad {
    [super viewDidLoad];
 
    self.imgs = @[@"支付宝支付（合并）",@"微信支付（合并）"];
    [self.collectionView registerClass:[JQFYPayTypeCollectionViewCell class] forCellWithReuseIdentifier:reuseIdentifier];
    self.collectionView.pagingEnabled = YES;
    self.collectionView.backgroundColor = [UIColor groupTableViewBackgroundColor];
    self.collectionView.showsHorizontalScrollIndicator = NO;
}


- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
    return 2;
}

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
    JQFYPayTypeCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:reuseIdentifier forIndexPath:indexPath];
    cell.imageName = self.imgs[indexPath.row];
    return cell;
}

- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
    NSUInteger offset = scrollView.contentOffset.x / DH_Screen_Width;
    if (offset == 0 || offset == 1) {
    
        if (self.offsetX) {
            self.offsetX(offset);
        }
    }
}
@end

